const Core = require('../../node_modules/zk-mini-core/miniprogram_dist/index');
class loginStorage{
    static exitLogin(){
      Core.storageRequest({'storageType':'remove','storageKey':'token'})
      Core.storageRequest({'storageType':'remove','storageKey':'customerId'})
      Core.storageRequest({'storageType':'remove','storageKey':'phone'})
      Core.storageRequest({'storageType':'remove','storageKey':'appId'})
      Core.storageRequest({'storageType':'remove','storageKey':'personPin'})
      Core.storageRequest({'storageType':'remove','storageKey':'userName'})
      Core.storageRequest({'storageType':'remove','storageKey':'companyId'})
      Core.storageRequest({'storageType':'remove','storageKey':'accountMember'})
      Core.storageRequest({'storageType':'remove','storageKey':'personPin'})
      Core.storageRequest({'storageType':'remove','storageKey':'appProductCode'})
      Core.storageRequest({'storageType':'remove','storageKey':'appCloudVersion'})
      Core.storageRequest({'storageType':'remove','storageKey':'appName'})
    }

    static signIn(userInfo){
      Core.storageRequest({'storageType':'set','storageKey':'token','storageValue':userInfo.data.token})
      Core.storageRequest({'storageType':'set','storageKey':'customerId','storageValue':userInfo.data.customerId})
      Core.storageRequest({'storageType':'set','storageKey':'userName','storageValue':userInfo.data.personName})
      Core.storageRequest({'storageType':'set','storageKey':'phone','storageValue':userInfo.data.phone})
      Core.storageRequest({'storageType':'set','storageKey':'appId','storageValue':userInfo.data.appId})
      Core.storageRequest({'storageType':'set','storageKey':'companyId','storageValue':userInfo.data.companyId})
      Core.storageRequest({'storageType':'set','storageKey':'personPin','storageValue':userInfo.data.personPin})
      Core.storageRequest({'storageType':'set','storageKey':'appProductCode','storageValue':userInfo.data.appProductCode})
      Core.storageRequest({'storageType':'set','storageKey':'appCloudVersion','storageValue':userInfo.data.appCloudVersion})
      Core.storageRequest({'storageType':'set','storageKey':'appName','storageValue':userInfo.data.appName})
    }
}
export {loginStorage}